package com.yonyou.pmclouds.constructiondiary.rmiimpl;

import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.basecom.ref.itf.RefCodeConst;
import com.yonyou.pmclouds.basecom.ref.itf.ReferenceCheckOfBusiness;
import com.yonyou.pmclouds.constructiondiary.entity.ConstructionDiaryVO;
import com.yonyou.pmclouds.constructiondiary.rmiitf.ConstructionDiaryQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ReferenceCheckOfConstructionDiary implements ReferenceCheckOfBusiness{
    @Autowired
    private ConstructionDiaryQuery query;
    @Override
    public String[] getReferenceCode() {
        
        return new String[]{RefCodeConst.PROJECT};
    }

    @Override
    public boolean checkReferenced(String bdCode, String[] keys) throws BusinessException {
        String code = null;
        if(RefCodeConst.PROJECT.equals(bdCode)) {
            code = ConstructionDiaryVO.PK_PROJECT;
        } else {
            throw new BusinessException("施工日志暂未引用该档案!");
       }
       return query.queryRefByIds(code, keys);
    }

}
